//
//  Queue.h
//  test
//
//  Created by yfy on 2022/3/2.
//

#ifndef Queue_h
#define Queue_h

namespace yfy
{
    template <class T, class Container = deque<T>>
    class queue
    {
    public:
        void push(const T& val)
        {
            _con.push_back(val);
        }
        void pop()
        {
            _con.pop_front();
        }
        T& front()
        {
            return _con.front();
        }
        T& back()
        {
            return _con.back();
        }
        size_t size()
        {
            return _con.size();
        }
        bool empty()
        {
            return _con.empty();
        }
    private:
        Container _con;
    };
    
    void test_queue()
    {
        queue<int> q;
        q.push(1);
        q.push(2);
        q.push(3);
        q.push(4);
        cout << q.size() << endl;
        while(!q.empty())
        {
            cout << q.front() << " ";
            q.pop();
        }
        cout << endl;
    }
}



#endif /* Queue_h */

